/**
 * 两数之和等于9
*/


const arr = [11, 2, 3, 5, 8, 7];

function add(arr) {
    const map = new Map();
    for (let i = 0; i < arr.length; i++) {
        const key = 9 - arr[i];
        if (map.has(key)) {
            return [map.get(key), i]
        } else {
            map.set(arr[i], i)
        }
    }
}
console.log(add(arr));